Graphics3D 640,480,16,2
HidePointer

Include "Trail.bb"
Include "TrailFunctions.bb"
Include "ColorValue.bb"
Include "ColorValueFunctions.bb"

WireFrame 0

Const TRAIL_LENGTH = 100

Const TRAIL_RED = 255
Const TRAIL_GREEN = 255
Const TRAIL_BLUE = 0
Const TRAIL_ALPHA# = 1

Global DISTANCE = 20

Global objCamera = CreateCamera()

Global objSphere = CreateSphere()
Global objSphere2 = CreateSphere()

SetupTrail( CreateTrail( objSphere , objSphere2 , CreateColorValue( TRAIL_RED , TRAIL_GREEN , TRAIL_BLUE , TRAIL_ALPHA ) ) , TRAIL_LENGTH )

While Not KeyHit(1)
	
	Angle = ATan2#( MouseX() - GraphicsWidth()/2 , MouseY() - GraphicsHeight()/2 )
		
	PositionEntity objSphere,Float((MouseX()-GraphicsWidth()/2))/(DISTANCE / 2) , Float(-(MouseY()-GraphicsHeight()/2))/(DISTANCE / 2) , DISTANCE
	PositionEntity objSphere2 , EntityX(objSphere) - Sin( Angle ) * 5 , EntityY(objSphere) + Cos(Angle) * 5 , EntityZ(objSphere)
	
	UpdateTrails()
	
	RenderWorld
	Flip
	
Wend